﻿using System.Windows;
using System.Windows.Controls;

namespace NielsHebling.UnitTestResultViewerForSL.Controls
{
    public class ExtendedGridViewColumn : GridViewColumn
    {
        public string SortProperty
        {
            get { return (string)GetValue(SortPropertyProperty); }
            set { SetValue(SortPropertyProperty, value); }
        }

        // Using a DependencyProperty as the backing store for SortProperty.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty SortPropertyProperty =
            DependencyProperty.Register("SortProperty", typeof(string), typeof(ExtendedGridViewColumn), new UIPropertyMetadata(""));



        public bool IsDefaultSortColumn
        {
            get { return (bool)GetValue(IsDefaultSortColumnProperty); }
            set { SetValue(IsDefaultSortColumnProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IsDefaultSortColumn.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsDefaultSortColumnProperty =
            DependencyProperty.Register("IsDefaultSortColumn", typeof(bool), typeof(ExtendedGridViewColumn), new UIPropertyMetadata(false));



        public bool IsFullContentColumn
        {
            get { return (bool)GetValue(IsFullContentColumnProperty); }
            set { SetValue(IsFullContentColumnProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IsFullContentColumn.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsFullContentColumnProperty =
            DependencyProperty.Register("IsFullContentColumn", typeof(bool), typeof(ExtendedGridViewColumn), new UIPropertyMetadata(true));


        public ExtendedGridViewColumn()
        {
            Style rightAlignmentStyle = new Style(typeof(GridViewColumnHeader));
            Setter setterAlignment = new Setter(GridViewColumnHeader.HorizontalContentAlignmentProperty, HorizontalAlignment.Left);
            rightAlignmentStyle.Setters.Add(setterAlignment);

            this.HeaderContainerStyle = rightAlignmentStyle;
        }
    }
}
